package com.xxzb.pack0720;

import java.sql.*;
import java.util.Scanner;

public class Test9 {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        System.out.println("请您输入需要查询的还书时间：");
        String backdate=sc.next();
        Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql:///gaofeng2207?useSSL=false";
        String username = "root";
        String password = "1234";
        Connection conn= DriverManager.getConnection(url,username,password);
        String sql="select * from gaofeng2207.borrowinfo where backdate=? ";
        PreparedStatement ps=conn.prepareStatement(sql);
        ps.setString(1,backdate);
        ResultSet rs = ps.executeQuery();
        while (rs.next()){
            int borrowId=rs.getInt(1);
            int bookId=rs.getInt(2);
            int readerId=rs.getInt(3);
            String borrowDate=rs.getString(4);
            String backDate=rs.getString(5);
            System.out.print("borrowId："+borrowId+"\t");
            System.out.print("bookId："+bookId+"\t");
            System.out.print("readerId："+readerId+"\t");
            System.out.print("borrowDate："+borrowDate+"\t");
            System.out.print("backDate："+backDate+"\n");
        }


    }
}
